package com.gardenguell.salad.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import com.gardenguell.salad.R;
import com.gardenguell.salad.ui.activity.base.BaseActivity;
import com.gardenguell.salad.util.SharedPreferenceUtil;
import com.umeng.update.UmengUpdateAgent;


/**
 * Created by absurd on 2015/11/14.
 */
public class SplashActivity extends BaseActivity {

    private static final int SPLASH_TIME = 3000;

    private Handler mHandler = new Handler();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        UmengUpdateAgent.update(this);
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if(getToken().isEmpty()){
                    startActivity(new Intent(SplashActivity.this, WelcomeActivity.class));
                }else{
                    startActivity(new Intent(SplashActivity.this, MainActivity.class));
                }
                finish();
            }
        }, SPLASH_TIME);

    }
}